USERNAME = group14
ASSIGNMENT = 09
SERVER = 138.232.64.210
PORT = 22113
FILES = ConnectionHandlerMixnode.cpp mixnode.cpp mixclient.cpp mixpack assignment09.txt

#CXXFLAGS += -O2 -Wall
CXXFLAGS += -O0 -Wall -g
CXXFLAGS += $(shell pkg-config --cflags libssl)
LDFLAGS += $(shell pkg-config --libs libssl)
BINS = mixnode mixclient
SRCS = ConnectionHandlerMixnode.cpp ConnectSocket.cpp GenericException.cpp mixnode.cpp mixclient.cpp ListenSocket.cpp TCPConnection.cpp hexdump.cpp
HDRS = BoundedBuffer.hpp ConnectionHandler.hpp ConnectSocket.hpp GenericException.hpp IP.hpp ListenSocket.hpp Logger.hpp SSLWrapper.hpp
OBJS = ConnectionHandlerMixnode.o ConnectSocket.o GenericException.o ListenSocket.o TCPConnection.o hexdump.o

.PHONY: upload sense clean

all: $(BINS)

upload:
	touch check
	scp -P $(PORT) check $(FILES) $(USERNAME)@$(SERVER):assignment$(ASSIGNMENT)

sense:
	scp -P $(PORT) $(USERNAME)@$(SERVER):log.txt $(USERNAME)@$(SERVER):compile.log .
	tail compile.log log.txt

clean:
	rm -f $(BINS) $(OBJS) $(DEPSFILE)

$(BINS): %: %.cpp $(HDRS) $(OBJS) $(DEPSFILE)
	$(CXX) $(CFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(OBJS)

$(DEPSFILE): $(SRCS)
	$(CXX) -MM $(SRCS) > $(DEPSFILE)

-include $(DEPSFILE)

